package net.models;

// Generated 11 avr. 2013 10:40:17 by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * Praticiens generated by hbm2java
 */
@Entity
@Table(name = "praticiens", catalog = "bom")
public class Praticiens extends AbstractModel {

	private int						id;
	private TypesPraticiens			typesPraticiens;
	private String					name;
	private String					prenom;
	private String					adresse;
	private String					cp;
	private String					ville;
	private Float					coefNotoriete;
	private boolean					remplacant;
	private Set<RapportsVisites>	rapportsVisiteses	= new HashSet<RapportsVisites>(0);

	public Praticiens() {
		typesPraticiens = new TypesPraticiens();
	}

	public Praticiens(int id, TypesPraticiens typesPraticiens, boolean remplacant, Date created, Date modified) {
		this.id = id;
		this.typesPraticiens = typesPraticiens;
		this.remplacant = remplacant;
	}

	public Praticiens(int id, TypesPraticiens typesPraticiens, String name, String prenom, String adresse, String cp, String ville, Float coefNotoriete, boolean remplacant, Date created, Date modified, Set<RapportsVisites> rapportsVisiteses) {
		this.id = id;
		this.typesPraticiens = typesPraticiens;
		this.name = name;
		this.prenom = prenom;
		this.adresse = adresse;
		this.cp = cp;
		this.ville = ville;
		this.coefNotoriete = coefNotoriete;
		this.remplacant = remplacant;
		this.rapportsVisiteses = rapportsVisiteses;
	}

	public Praticiens(String name, String prenom, String adresse, String cp, String ville, TypesPraticiens typePraticiens) {
		this.name = name;
		this.prenom = prenom;
		this.adresse = adresse;
		this.cp = cp;
		this.ville = ville;
		this.typesPraticiens = typePraticiens;
	}

	public Praticiens(int id, String name, String prenom, String adresse, String cp, String ville, TypesPraticiens typePraticiens) {
		this.id = id;
		this.name = name;
		this.prenom = prenom;
		this.adresse = adresse;
		this.cp = cp;
		this.ville = ville;
		this.typesPraticiens = typePraticiens;
	}

	public Praticiens(int id2) {
		this.id = id2;
	}

	@Id
	@GenericGenerator(name = "gui", strategy = "increment")
	@GeneratedValue(generator = "gui")
	@Column(name = "id", unique = true, nullable = false)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		int oldValue = this.id;
		this.id = id;
		firePropertyChange("id", oldValue, id);
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "types_praticien_id", nullable = false)
	public TypesPraticiens getTypesPraticiens() {
		return this.typesPraticiens;
	}

	public void setTypesPraticiens(TypesPraticiens typesPraticiens) {
		TypesPraticiens oldValue = this.typesPraticiens;
		this.typesPraticiens = typesPraticiens;
		firePropertyChange("typesPraticiens", oldValue, typesPraticiens);
	}

	@Column(name = "name", length = 25)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		String oldValue = this.name;
		this.name = name;
		firePropertyChange("name", oldValue, name);
	}

	@Column(name = "prenom", length = 30)
	public String getPrenom() {
		return this.prenom;
	}

	public void setPrenom(String prenom) {
		String oldValue = this.prenom;
		this.prenom = prenom;
		firePropertyChange("prenom", oldValue, prenom);
	}

	@Column(name = "adresse", length = 50)
	public String getAdresse() {
		return this.adresse;
	}

	public void setAdresse(String adresse) {
		String oldValue = this.adresse;
		this.adresse = adresse;
		firePropertyChange("adresse", oldValue, adresse);
	}

	@Column(name = "cp", length = 5)
	public String getCp() {
		return this.cp;
	}

	public void setCp(String cp) {
		String oldValue = this.cp;
		this.cp = cp;
		firePropertyChange("cp", oldValue, cp);
	}

	@Column(name = "ville", length = 25)
	public String getVille() {
		return this.ville;
	}

	public void setVille(String ville) {
		String oldValue = this.ville;
		this.ville = ville;
		firePropertyChange("ville", oldValue, ville);
	}

	@Column(name = "coefNotoriete", precision = 12, scale = 0)
	public Float getCoefNotoriete() {
		return this.coefNotoriete;
	}

	public void setCoefNotoriete(Float coefNotoriete) {
		Float oldValue = this.coefNotoriete;
		this.coefNotoriete = coefNotoriete;
		firePropertyChange("coefNotoriete", oldValue, coefNotoriete);
	}

	@Column(name = "remplacant", nullable = false)
	public boolean isRemplacant() {
		return this.remplacant;
	}

	public void setRemplacant(boolean remplacant) {
		boolean oldValue = this.remplacant;
		this.remplacant = remplacant;
		firePropertyChange("remplacant", oldValue, remplacant);
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "praticiens")
	public Set<RapportsVisites> getRapportsVisiteses() {
		return this.rapportsVisiteses;
	}

	public void setRapportsVisiteses(Set<RapportsVisites> rapportsVisiteses) {
		Set<RapportsVisites> oldValue = this.rapportsVisiteses;
		this.rapportsVisiteses = rapportsVisiteses;
		firePropertyChange("rapportsVisiteses", oldValue, rapportsVisiteses);
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Praticiens)
			return ((Praticiens) obj).getName().equals(name);
		return super.equals(obj);
	}

}
